package com.itheima.pattern.flyweight;

public class Client {
    public static void main(String[] args) {
        BoxFactory boxFactory = BoxFactory.getInstance();
        AbstractBox box1 = boxFactory.getBox("I");
        box1.display("Red");

        AbstractBox box2 = boxFactory.getBox("L");
        box2.display("Yellow");

        AbstractBox box3 = boxFactory.getBox("O");
        box3.display("Blue");

        AbstractBox box4 = boxFactory.getBox("O");
        box4.display("Green");

        // 判断对象是否相同
        System.out.println(box3 == box4); // true

        System.out.println(box3);
    }
}
